package com.weixing.mall.provider.controller;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.weixing.mall.base.wrapper.Result;
import com.weixing.mall.base.wrapper.ResultUtil;
import com.weixing.mall.core.annotation.NoNeedAccess;
import com.weixing.mall.core.annotation.SysLog;
import com.weixing.mall.core.enums.OperateEnum;
import com.weixing.mall.core.support.BaseController;
import com.weixing.mall.provider.model.vo.report.delivery.*;
import com.weixing.mall.provider.service.IDayReportDeliveryService;
import com.weixing.mall.provider.util.EasyExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;

/**
 * @author jzy
 * @date 2020/6/2
 */
@RestController
@RequestMapping("report")
@Api(value = "后台报表APi", tags = "后台报表-发货部报表")
public class ReportDeliveryController extends BaseController {
    @Autowired
    private IDayReportDeliveryService deliveryService;
    @ApiOperation(value = "01 发货部报表--发货员发货数据报表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "monthTime", value = "月份时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/send/data")
    public Result<IPage<DeliveryShipperSendDataVo>> shipperSendData(Long shipperId, String startTime, String endTime,String monthTime, Integer orderType,String sortField,String sortType){
        IPage<DeliveryShipperSendDataVo> page = deliveryService.shipperSendData(shipperId, startTime, endTime, monthTime, orderType, sortField, sortType, initMPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "01 发货部报表--发货员发货数据报表列表合计")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "monthTime", value = "月份时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/send/dataTotal")
    public Result shipperSendDataTotal(Long shipperId, String startTime, String endTime,String monthTime, Integer orderType,String sortField,String sortType){
        DeliveryShipperSendDataVo dssdv = deliveryService.shipperSendDataTotal(shipperId, startTime, endTime, monthTime, orderType, sortField, sortType, initMPage().setCurrent(1).setSize(1));
        return ResultUtil.success(dssdv);
    }
    @ApiOperation(value = "01 发货部报表--发货员发货数据报表-导出excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "monthTime", value = "月份时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/send/data/excel")
    @NoNeedAccess
    public void shipperSendDataExcel(Long shipperId, String startTime, String endTime,String monthTime, Integer orderType, String sortField, String sortType, HttpServletResponse response){
        IPage<DeliveryShipperSendDataVo> page = deliveryService.shipperSendData(shipperId, startTime, endTime,monthTime, orderType, sortField, sortType, new Page(1,-1));
        try {
            EasyExcelUtil.writeExcel(response,DeliveryShipperSendDataVo.class,page.getRecords(),"发货员发货数据报表");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @ApiOperation(value = "01 发货部报表--发货员发货数据报表-详细数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型  1当天订单 2发外采 3断货/取消 4发库存 5发换码 6发ERP 7ERP留存 8库存留存 9剩余总留存 ，10有单不发",required = false, paramType = "query"),
            @ApiImplicitParam(name = "customerId", value = "客服Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderStatus", value = "订单情况 1正常订单 2换货订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "itemStatus", value = "操作状态 1待定 2带货 3有现货 4需外采 5内部换货 6断货 7取消 8待处理 9退货",required = false, paramType = "query"),
            @ApiImplicitParam(name = "userName", value = "用户名",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/send/data/detail")
    public Result<IPage<DeliveryShipperSendDataDetailVo>> shipperSendDataDetail(Integer type,Long customerId, Long shipperId, String startTime, String endTime, Integer orderType, Integer orderStatus, Integer itemStatus, String userName, String sortField, String sortType){
        IPage iPage = deliveryService.shipperSendDataDetail(type,customerId,shipperId, startTime, endTime, orderType,orderStatus,itemStatus,userName, sortField, sortType, initMPage());
        return ResultUtil.success(iPage);
    }
    @ApiOperation(value = "01 发货部报表--发货员发货数据报表-详细数据-导出excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型  1当天订单 2发外采 3断货/取消 4发库存 5发换码 6发ERP 7ERP留存 8库存留存 9剩余总留存 ",required = false, paramType = "query"),
            @ApiImplicitParam(name = "customerId", value = "客服Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderStatus", value = "订单情况 1正常订单 2换货订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "itemStatus", value = "操作状态 1待定 2带货 3有现货 4需外采 5内部换货 6断货 7取消 8待处理 9退货",required = false, paramType = "query"),
            @ApiImplicitParam(name = "userName", value = "用户名",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/send/data/detail/excel")
    @NoNeedAccess
    @SysLog(type = OperateEnum.E,desp = "发货员发货数据报表-详细数据导出")
    public void shipperSendDataDetailExcel(Integer type,Long customerId, Long shipperId, String startTime, String endTime, Integer orderType, Integer orderStatus, Integer itemStatus, String userName, String sortField, String sortType,HttpServletResponse response){
        IPage<DeliveryShipperSendDataDetailVo> page = deliveryService.shipperSendDataDetail(type,customerId, shipperId, startTime, endTime, orderType, orderStatus, itemStatus, userName, sortField, sortType, new Page(1, -1));
        try {
            EasyExcelUtil.writeExcel(response,DeliveryShipperSendDataDetailVo.class,page.getRecords(),"发货员发货数据明细");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @ApiOperation(value = "02 发货部报表--发货员发货数据统计")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/send/data/statistics")
    public Result<IPage<DeliveryShipperSendDataStatisticsVo>> shipperSendDataStatistics(Long shipperId,String yearMonth,Integer orderType,String sortField,String sortType){
        if (StrUtil.isEmpty(yearMonth)){
            yearMonth=DateUtil.format(new Date(),"yyyy-MM");
        }
        IPage<DeliveryShipperSendDataStatisticsVo> page = deliveryService.shipperSendDataStatistics(shipperId, yearMonth, orderType, sortField, sortType, initMPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "02 发货部报表--发货员发货数据统计-导出excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/send/data/statistics/excel")
    @NoNeedAccess
    public void shipperSendDataStatisticsExcel(Long shipperId,String yearMonth,Integer orderType,String sortField,String sortType,HttpServletResponse response){
        if (StrUtil.isEmpty(yearMonth)){
            yearMonth= DateUtil.format(new Date(),"yyyy-MM");
        }
        IPage<DeliveryShipperSendDataStatisticsVo> page = deliveryService.shipperSendDataStatistics(shipperId, yearMonth, orderType, sortField, sortType, new Page(1,-1));
        try {
            EasyExcelUtil.writeExcel(response,DeliveryShipperSendDataStatisticsVo.class,page.getRecords(),"发货员发货数据统计");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @ApiOperation(value = "02 发货部报表--发货员发货数据统计-详细数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型  1本月接单 2转单 3上月留存订单 4小计 5断货本月订单 6断货上月订单 7断货小计 8上月自采自发 9上月发APP仓 10上月发ERP仓 11上月发换码 12本月自采自发 13本月发APP仓 14本月发ERP仓 15本月发换码 16发货小计 17留存上月订单 18留存本月订单 19留存小计",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderStatus", value = "订单情况 1正常订单 2换货订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "itemStatus", value = "操作状态 1待定 2带货 3有现货 4需外采 5内部换货 6断货 7取消 8待处理 9退货",required = false, paramType = "query"),
            @ApiImplicitParam(name = "userName", value = "用户名",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/send/data/statistics/detail")
    public Result<IPage<DeliveryShipperSendDataDetailVo>> shipperSendDataStatisticsDetail(Integer type,String yearMonth, Long shipperId, String startTime, String endTime, Integer orderType, Integer orderStatus, Integer itemStatus, String userName, String sortField, String sortType){
        if (StrUtil.isEmpty(yearMonth)){
            yearMonth=DateUtil.format(new Date(),"yyyy-MM");
        }
        IPage<DeliveryShipperSendDataDetailVo> page = deliveryService.shipperSendDataStatisticsDetail(type, yearMonth, shipperId, startTime, endTime, orderType, orderStatus, itemStatus, userName, sortField, sortType, initMPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "02 发货部报表--发货员发货数据统计-详细数据-导出excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型  1本月接单 2转单 3上月留存订单 4小计 5断货本月订单 6断货上月订单 7断货小计 8上月自采自发 9上月发APP仓 10上月发ERP仓 11上月发换码 12本月自采自发 13本月发APP仓 14本月发ERP仓 15本月发换码 16发货小计 17留存上月订单 18留存本月订单 19留存小计",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderStatus", value = "订单情况 1正常订单 2换货订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "itemStatus", value = "操作状态 1待定 2带货 3有现货 4需外采 5内部换货 6断货 7取消 8待处理 9退货",required = false, paramType = "query"),
            @ApiImplicitParam(name = "userName", value = "用户名",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/send/data/statistics/detail/excel")
    @NoNeedAccess
    @SysLog(type = OperateEnum.E,desp = "发货员发货数据统计-详细数据")
    public void shipperSendDataStatisticsDetailExcel(Integer type,String yearMonth, Long shipperId, String startTime, String endTime, Integer orderType, Integer orderStatus, Integer itemStatus, String userName, String sortField, String sortType,HttpServletResponse response){
        if (StrUtil.isEmpty(yearMonth)){
            yearMonth=DateUtil.format(new Date(),"yyyy-MM");
        }
        IPage<DeliveryShipperSendDataDetailVo> page = deliveryService.shipperSendDataStatisticsDetail(type, yearMonth, shipperId, startTime, endTime, orderType, orderStatus, itemStatus, userName, sortField, sortType, new Page(1,-1));
        try {
            EasyExcelUtil.writeExcel(response,DeliveryShipperSendDataDetailVo.class,page.getRecords(),"发货员发货数据统计明细");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @ApiOperation(value = "03发货部-发货员换码采购报表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/exchange/report")
    public Result<List<DeliveryShipperExchangeReportVo>> shipperExchangeReport(Long shipperId, String yearMonth, Integer orderType, String sortField, String sortType){
        if (StrUtil.isEmpty(yearMonth)){
            yearMonth=DateUtil.format(new Date(),"yyyy-MM");
        }
        List<DeliveryShipperExchangeReportVo>  list = deliveryService.shipperExchangeReport(shipperId, yearMonth, orderType, sortField, sortType);
        return ResultUtil.success(list);
    }
    @ApiOperation(value = "03发货部-发货员换码采购报表-导出excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/exchange/report/excel")
    @NoNeedAccess
    @SysLog(type = OperateEnum.E,desp = "-发货员换码采购报表导出")
    public void shipperExchangeReportExcel(Long shipperId, String yearMonth, Integer orderType, String sortField, String sortType,HttpServletResponse response){
        if (StrUtil.isEmpty(yearMonth)){
            yearMonth=DateUtil.format(new Date(),"yyyy-MM");
        }
        List<DeliveryShipperExchangeReportVo>  list = deliveryService.shipperExchangeReport(shipperId, yearMonth, orderType, sortField, sortType);
        try {
            EasyExcelUtil.writeExcel(response,DeliveryShipperExchangeReportVo.class,list,"发货员换码采购报表");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @ApiOperation(value = "03发货部-发货员换码采购报表-详细数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型  1总单 2采购 3断货 4库存 5ERP 6留存",required = false, paramType = "query"),
            @ApiImplicitParam(name = "date", value = "年月/年月日 点击的数值的日期",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 点击数值的年月筛选条件 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderStatus", value = "订单情况 1正常订单 2换货订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "itemStatus", value = "操作状态 1待定 2带货 3有现货 4需外采 5内部换货 6断货 7取消 8待处理 9退货",required = false, paramType = "query"),
            @ApiImplicitParam(name = "userName", value = "用户名",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/exchange/report/detail")
    public Result<IPage<DeliveryShipperSendDataDetailVo>> shipperExchangeReportDetail(Integer type,String date,String yearMonth,Long shipperId, String startTime, String endTime, Integer orderType, Integer orderStatus, Integer itemStatus, String userName, String sortField, String sortType){
        if (StrUtil.isEmpty(yearMonth)){
            yearMonth=DateUtil.format(new Date(),"yyyy-MM");
        }
        IPage<DeliveryShipperSendDataDetailVo> page = deliveryService.shipperExchangeReportDetail(type, date, yearMonth, shipperId, startTime, endTime, orderType, orderStatus, itemStatus, userName, sortField, sortType, initMPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "03发货部-发货员换码采购报表-详细数据-导出excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型  1总单 2采购 3断货 4库存 5ERP 6留存",required = false, paramType = "query"),
            @ApiImplicitParam(name = "date", value = "年月/年月日 点击的数值的日期",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 点击数值的年月筛选条件 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderStatus", value = "订单情况 1正常订单 2换货订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "itemStatus", value = "操作状态 1待定 2带货 3有现货 4需外采 5内部换货 6断货 7取消 8待处理 9退货",required = false, paramType = "query"),
            @ApiImplicitParam(name = "userName", value = "用户名",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/exchange/report/detail/excel")
    @NoNeedAccess
    public void shipperExchangeReportDetailExcel(Integer type,String date,String yearMonth,Long shipperId, String startTime, String endTime, Integer orderType, Integer orderStatus, Integer itemStatus, String userName, String sortField, String sortType,HttpServletResponse response){
        if (StrUtil.isEmpty(yearMonth)){
            yearMonth=DateUtil.format(new Date(),"yyyy-MM");
        }
        IPage<DeliveryShipperSendDataDetailVo> page = deliveryService.shipperExchangeReportDetail(type, date, yearMonth, shipperId, startTime, endTime, orderType, orderStatus, itemStatus, userName, sortField, sortType, new Page(1,-1));
        try {
            EasyExcelUtil.writeExcel(response,DeliveryShipperSendDataDetailVo.class,page.getRecords(),"发货员换码采购明细");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @ApiOperation(value = "04 发货部报表--外采报表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderStatus", value = "订单情况 1正常订单 2换货订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "itemStatus", value = "操作状态 1待定 2带货 3有现货 4需外采 5内部换货 6断货 7取消 8待处理 9退货",required = false, paramType = "query"),
            @ApiImplicitParam(name = "userName", value = "用户名",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/send/out")
    public Result<IPage<DeliveryShipperOutVo>> shipperOutReport(Long shipperId, String startTime, String endTime, Integer orderType, Integer orderStatus, Integer itemStatus, String userName, String sortField, String sortType){
        IPage<DeliveryShipperOutVo> iPage = deliveryService.shipperOutReport(shipperId, startTime, endTime, orderType,orderStatus,itemStatus,userName, sortField, sortType, initMPage());
        return ResultUtil.success(iPage);
    }
    @ApiOperation(value = "04 发货部报表--外采报表-导出excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderStatus", value = "订单情况 1正常订单 2换货订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "itemStatus", value = "操作状态 1待定 2带货 3有现货 4需外采 5内部换货 6断货 7取消 8待处理 9退货",required = false, paramType = "query"),
            @ApiImplicitParam(name = "userName", value = "用户名",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/send/out/excel")
    @NoNeedAccess
    public void shipperOutReportExcel(Long shipperId, String startTime, String endTime, Integer orderType, Integer orderStatus, Integer itemStatus, String userName, String sortField, String sortType,HttpServletResponse response){
        IPage<DeliveryShipperOutVo> page = deliveryService.shipperOutReport(shipperId, startTime, endTime, orderType,orderStatus,itemStatus,userName, sortField, sortType, new Page(1,-1));
        try {
            EasyExcelUtil.writeExcel(response,DeliveryShipperOutVo.class,page.getRecords(),"外采报表");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


    @ApiOperation(value = "05 发货部-绩效报表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "actId", value = "活动ID",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/performance")
    public Result<IPage<DeliveryShipperPerformanceVo>> shipperPerformance(Long shipperId,Long actId,Integer orderType,String startTime,String endTime,String sortField,String sortType){
        IPage<DeliveryShipperPerformanceVo> page = deliveryService.shipperPerformance(shipperId,actId, orderType,startTime, endTime, sortField, sortType, initMPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "05 发货部-绩效报表-导出excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "actId", value = "活动ID",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/performance/excel")
    @NoNeedAccess
    public void shipperPerformanceExcel(Long shipperId,Long actId,Integer orderType,String startTime,String endTime,String sortField,String sortType,HttpServletResponse response){
        IPage<DeliveryShipperPerformanceVo> page = deliveryService.shipperPerformance(shipperId,actId,orderType, startTime, endTime, sortField, sortType, new Page(1,-1));
        try {
            EasyExcelUtil.writeExcel(response,DeliveryShipperPerformanceVo.class,page.getRecords(),"发货员绩效报表");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @ApiOperation(value = "05 发货部-绩效报表-详细数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型  1发货数 2断货数 3取消数 4退货数 5实际发货数",required = false, paramType = "query"),
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderStatus", value = "订单情况 1正常订单 2换货订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "itemStatus", value = "操作状态 1待定 2带货 3有现货 4需外采 5内部换货 6断货 7取消 8待处理 9退货",required = false, paramType = "query"),
            @ApiImplicitParam(name = "userName", value = "用户名",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/performance/detail")
    public Result<IPage<DeliveryShipperSendDataDetailVo>> shipperPerformanceDetail(Integer type,Long shipperId, String startTime, String endTime, Integer orderType, Integer orderStatus, Integer itemStatus, String userName, String sortField, String sortType){
        IPage<DeliveryShipperSendDataDetailVo> page = deliveryService.shipperPerformanceDetail(type, shipperId, startTime, endTime, orderType, orderStatus, itemStatus, userName, sortField, sortType, initMPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "05 发货部-绩效报表-详细数据-导出excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型  1发货数 2断货数 3取消数 4退货数 5实际发货数",required = false, paramType = "query"),
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderStatus", value = "订单情况 1正常订单 2换货订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "itemStatus", value = "操作状态 1待定 2带货 3有现货 4需外采 5内部换货 6断货 7取消 8待处理 9退货",required = false, paramType = "query"),
            @ApiImplicitParam(name = "userName", value = "用户名",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/performance/detail/excel")
    @NoNeedAccess
    public void shipperPerformanceDetailExcel(Integer type,Long shipperId, String startTime, String endTime, Integer orderType, Integer orderStatus, Integer itemStatus, String userName, String sortField, String sortType,HttpServletResponse response){
        IPage<DeliveryShipperSendDataDetailVo> page = deliveryService.shipperPerformanceDetail(type, shipperId, startTime, endTime, orderType, orderStatus, itemStatus, userName, sortField, sortType, new Page(1,-1));
        try {
            EasyExcelUtil.writeExcel(response,DeliveryShipperSendDataDetailVo.class,page.getRecords(),"发货员绩效明细");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @ApiOperation(value = "06发货部-留存发货数据报表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "groupByType", value = "分组类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/remain/report")
    public Result<List<DeliveryShipperRemainReportVo>> shipperRemainReport(Long shipperId, String yearMonth, Integer orderType, String sortField,String groupByType ,String sortType){
        if (StrUtil.isEmpty(yearMonth)){
            yearMonth=DateUtil.format(new Date(),"yyyy-MM");
        }
        List<DeliveryShipperRemainReportVo>  list = deliveryService.shipperRemainReport(shipperId, yearMonth, orderType, sortField,groupByType, sortType);
        return ResultUtil.success(list);
    }
    @ApiOperation(value = "06发货部-留存发货数据报表-导出excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "groupByType", value = "分组类型",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/remain/report/excel")
    @NoNeedAccess
    public void shipperRemainReportExcel(Long shipperId, String yearMonth, Integer orderType, String sortField, String sortType,String groupByType,HttpServletResponse response){
        if (StrUtil.isEmpty(yearMonth)){
            yearMonth=DateUtil.format(new Date(),"yyyy-MM");
        }
        List<DeliveryShipperRemainReportVo>  list = deliveryService.shipperRemainReport(shipperId, yearMonth, orderType, sortField,groupByType, sortType);
        try {
            EasyExcelUtil.writeExcel(response,DeliveryShipperRemainReportVo.class,list,"留存发货数据报表");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @ApiOperation(value = "06发货部-留存发货数据报表-详细数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型  1总单 2采购 3断货 4库存 5ERP 6留存",required = false, paramType = "query"),
            @ApiImplicitParam(name = "date", value = "年月/年月日 点击的数值的日期",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 点击数值的年月筛选条件 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderStatus", value = "订单情况 1正常订单 2换货订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "itemStatus", value = "操作状态 1待定 2带货 3有现货 4需外采 5内部换货 6断货 7取消 8待处理 9退货",required = false, paramType = "query"),
            @ApiImplicitParam(name = "userName", value = "用户名",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/remain/report/detail")
    public Result<IPage<DeliveryShipperSendDataDetailVo>> shipperRemainReportDetail(Integer type,String date,String yearMonth,Long shipperId, String startTime, String endTime, Integer orderType, Integer orderStatus, Integer itemStatus, String userName, String sortField, String sortType){
        if (StrUtil.isEmpty(yearMonth)){
            yearMonth=DateUtil.format(new Date(),"yyyy-MM");
        }
        IPage<DeliveryShipperSendDataDetailVo> page = deliveryService.shipperRemainReportDetail(type, date, yearMonth, shipperId, startTime, endTime, orderType, orderStatus, itemStatus, userName, sortField, sortType, initMPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "06发货部-留存发货数据报表-详细数据-导出excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型  1总单 2采购 3断货 4库存 5ERP 6留存",required = false, paramType = "query"),
            @ApiImplicitParam(name = "date", value = "年月/年月日 点击的数值的日期",required = false, paramType = "query"),
            @ApiImplicitParam(name = "yearMonth", value = "年月 点击数值的年月筛选条件 例：2020-06",required = false, paramType = "query"),
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderStatus", value = "订单情况 1正常订单 2换货订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "itemStatus", value = "操作状态 1待定 2带货 3有现货 4需外采 5内部换货 6断货 7取消 8待处理 9退货",required = false, paramType = "query"),
            @ApiImplicitParam(name = "userName", value = "用户名",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/shipper/remain/report/detail/excel")
    @NoNeedAccess
    public void shipperRemainReportDetailExcel(Integer type,String date,String yearMonth,Long shipperId, String startTime, String endTime, Integer orderType, Integer orderStatus, Integer itemStatus, String userName, String sortField, String sortType,HttpServletResponse response){
        if (StrUtil.isEmpty(yearMonth)){
            yearMonth=DateUtil.format(new Date(),"yyyy-MM");
        }
        IPage<DeliveryShipperSendDataDetailVo> page = deliveryService.shipperRemainReportDetail(type, date, yearMonth, shipperId, startTime, endTime, orderType, orderStatus, itemStatus, userName, sortField, sortType, new Page(1,-1));
        try {
            EasyExcelUtil.writeExcel(response,DeliveryShipperSendDataDetailVo.class,page.getRecords(),"留存发货数据明细");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @ApiOperation(value = "07 发货部报表--发货部发货整体报表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "actId", value = "活动Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "monthTime", value = "月份时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/whole/report")
    public Result<IPage<DeliveryWholeReportVo>> wholeReport(Long shipperId,Long actId, String startTime, String endTime,String monthTime, Integer orderType,String sortField,String sortType){
        IPage<DeliveryWholeReportVo> page = deliveryService.wholeReport(shipperId,actId, startTime, endTime,monthTime, orderType, sortField, sortType, initMPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "07 发货部报表--发货部发货整体报表-导出excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "actId", value = "活动Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "monthTime", value = "月份时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/whole/report/excel")
    @NoNeedAccess
    public void wholeReportExcel(Long shipperId,Long actId, String startTime, String endTime,String monthTime, Integer orderType,String sortField,String sortType,HttpServletResponse response){
        IPage<DeliveryWholeReportVo> page = deliveryService.wholeReport(shipperId,actId, startTime, endTime, monthTime, orderType, sortField, sortType, new Page(1,-1));
        try {
            EasyExcelUtil.writeExcel(response,DeliveryWholeReportVo.class,page.getRecords(),"发货部发货整体报表");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


    @ApiOperation(value = "07 发货部报表--发货部发货整体报表-详细数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型  1总订单 2发出 3断货 4取消 5有现货 6待定 7待货 8置换发出 9置换未发  10APP仓发出 11APP仓未发",required = false, paramType = "query"),
            @ApiImplicitParam(name = "date", value = "日期 点击的数值的日期",required = false, paramType = "query"),
            @ApiImplicitParam(name = "customerId", value = "客服Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderStatus", value = "订单情况 1正常订单 2换货订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "itemStatus", value = "操作状态 1待定 2带货 3有现货 4需外采 5内部换货 6断货 7取消 8待处理 9退货",required = false, paramType = "query"),
            @ApiImplicitParam(name = "userName", value = "用户名",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/whole/report/detail")
    public Result<IPage<DeliveryShipperSendDataDetailVo>> wholeReportDetail(Integer type,String date,Long customerId, Long shipperId, String startTime, String endTime, Integer orderType, Integer orderStatus, Integer itemStatus, String userName, String sortField, String sortType){
        IPage<DeliveryShipperSendDataDetailVo> page = deliveryService.wholeReportDetail(type, date,customerId, shipperId, startTime, endTime, orderType, orderStatus, itemStatus, userName, sortField, sortType, initMPage());
        return ResultUtil.success(page);
    }
    @ApiOperation(value = "07 发货部报表--发货部发货整体报表-详细数据-导出excel")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型  1总订单 2发出 3断货 4取消 5有现货 6待定 7待货 8置换发出 9置换未发  10APP仓发出 11APP仓未发",required = false, paramType = "query"),
            @ApiImplicitParam(name = "date", value = "日期 点击的数值的日期",required = false, paramType = "query"),
            @ApiImplicitParam(name = "customerId", value = "客服Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "shipperId", value = "发货员Id",required = false, paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束时间",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderType", value = "订单类型 1正价订单 2代理商活动订单 3秒杀活动订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "orderStatus", value = "订单情况 1正常订单 2换货订单",required = false, paramType = "query"),
            @ApiImplicitParam(name = "itemStatus", value = "操作状态 1待定 2带货 3有现货 4需外采 5内部换货 6断货 7取消 8待处理 9退货",required = false, paramType = "query"),
            @ApiImplicitParam(name = "userName", value = "用户名",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortField", value = "排序字段",required = false, paramType = "query"),
            @ApiImplicitParam(name = "sortType", value = "排序类型  asc正序  desc倒序",required = false, paramType = "query")
    })
    @GetMapping("/delivery/whole/report/detail/excel")
    @NoNeedAccess
    public void wholeReportDetailExcel(Integer type,String date, Long customerId, Long shipperId, String startTime, String endTime, Integer orderType, Integer orderStatus, Integer itemStatus, String userName, String sortField, String sortType,HttpServletResponse response){
        IPage<DeliveryShipperSendDataDetailVo> page = deliveryService.wholeReportDetail(type, date,customerId, shipperId, startTime, endTime, orderType, orderStatus, itemStatus, userName, sortField, sortType, new Page(1,-1));
        try {
            EasyExcelUtil.writeExcel(response,DeliveryShipperSendDataDetailVo.class,page.getRecords(),"发货部发货整体明细");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
